{{ template "header" . }}

{{ with .Data.Cheevo }}
<div id=popups>
    <div>
        <h3>Achievement Earned!</h3>
        {{ .Emoji }}<p>{{ .Name }}
    </div>
</div>
{{ end }}

<header id=page-header><h1>About</h1></header>

<main>
    <dl>
        <dt>Do I need to log in to play?
        <dd>
            No. Submitted solutions will be executed and checked without
            logging in, but nothing will be saved and you won't appear on the
            <a href=rankings/holes/all/all/bytes>leaderboards</a>.

        <dt>Is code.golf free as in speech?
        <dd>
            Yes! It is written in <a href=//golang.org>Go</a>, licensed under
            <a href=//opensource.org/licenses/MIT>MIT</a>, and available on
            <a href=//github.com/code-golf/code-golf>GitHub</a>; patches welcome!

        <dt>Is code.golf free as in beer?
        <dd>
            <p>
                Yes! However hosting isn't, so if you enjoy Code Golf consider
                donating to its continued existence and improvement via
                <a href=//github.com/sponsors/JRaspass>GitHub Sponsors</a>.

            <p>
                Sponsors will receive a couple of additional perks, with more
                planned:

            <table>
                <caption>* Badge hidden if sponsorship is anonymous.
                <thead>
                    <tr>
                        <th>
                        <th>Free
                        <th>Sponsor
                <tbody>
                    <tr>
                        <th>Profile Badge
                        <td>No
                        <td>Yes *
                    <tr>
                        <th>Follow Limit
                        <td>{{ .Data.FollowLimit }}
                        <td>{{ .Data.FollowLimitSponsor }}
                    <tr>
                        <th>Solution Notes
                        <td>No
                        <td>Yes
            </table>

        <dt>What languages are supported?
        <dd id=langs>
        {{ $seenExp := false }}
        {{ range .Data.Langs }}
            {{ if and .Experiment (not $seenExp) }}
                {{ $seenExp = true }}
                <p>Experimental languages:</p>
            {{ end }}
                <a href="{{ .Website }}" title="{{ .Name }} - {{ .Version }}">
                    {{ svg .ID }}
                    <h2>{{ .Name }}</h2>
                    <span>{{ .Version }}</span>
                </a>
        {{ end }}
            <p>
                If you'd like to see another language added then raise an
                <a href=//github.com/code-golf/code-golf/issues/new/choose>issue</a>.
        <dt>Are warnings ignored?
        <dd>
            Yes. Only STDOUT is checked against the solution, STDERR is
            however shown back to you to ease debugging.
            
        <dt>Is trailing whitespace ignored?
        <dd>
            Trailing whitespace is trimmed from each line and the entire
            output, except when solving <a href=quine>Quine</a>.

        <dt>How are arguments passed to my program?
        <dd>
            Some holes pass arguments, for those your program should read them
            from the command line arguments (ARGV).

        <dt>How do I print Unicode characters?
        <dd>
            <p>
                Your source code is sent to the interpreter encoded in UTF-8,
                and is expected to write output encoded in UTF-8 to STDOUT.
                For languages where it matters, your code is run in the
                <code>en_US</code> locale with a UTF-8 output encoding.
            <p>
                In Unicode-aware languages like Python, this means
                <code>print("🙂")</code> and <code>print(chr(0x1f642))</code>
                both produce the emoji U+1F642 "Slightly Smiling Face" 🙂, which
                is encoded as <code>f0 9f 99 82</code> in UTF-8.
            <p>
                In less Unicode-aware languages where strings are byte strings,
                you might still get away with UTF-8 in string literals. For
                example, OCaml treats <code>"🙂"</code> as a string of length 4
                (four bytes), but <code>Char.chr 0x1f642</code> is an error.
            <p>
                In yet other languages, like brainfuck, you have to print the
                individual bytes <code>f0 9f 99 82</code> one by one.

        <dt>How are solutions ranked?
        <dd>
            <p>
                There are two scorings in use, bytes and chars. Bytes is the
                number of bytes of a solution encoded in UTF-8. Chars is the
                number of Unicode codepoints of a solution. Users may submit up to
                two solutions per hole per language. This is handled automatically
                when you enter two solutions and each minimizes a different
                scoring. Each scoring has its own set of leaderboards. For the
                chars scoring, both “A” (U+0041 Latin Capital Letter A) and “😉”
                (U+1F609 Winking Face) cost the same despite the 1:4 ratio in byte
                count in UTF-8.

            <p id=strokes>
                Some experimental languages that make heavy use of multi-byte
                characters (APL, UIUA, 05AB1E, BQN, Vyxal) have a third scoring
                method that does not yet affect leaderboards or solution saving.
                This method allows multi-byte characters commonly used in the
                language to count for only one stroke, while all other characters
                count as one stroke for every UTF-8 byte in their encoding.
                Reference
                <a href="https://github.com/code-golf/code-golf/pull/2513">PR#2513</a>
                for more detail.

        <dt>How are solutions scored?
        <dd>
            For each hole, in each language, up to 1,000 points are available.
            The formula is:
            <blockquote>
                <i>Points</i> =
                    <i>S<sub>b</sub></i> ÷ <i>S<sub>u</sub></i> × 1000
            </blockquote>
            Where <i>S<sub>u</sub></i> is the length of the user's solution,
            and <i>S<sub>b</sub></i> is a Bayesian estimator of the form:
            <blockquote>
                <i>S<sub>b</sub></i> = ((<i>√n</i> + 2) ÷ (<i>√n</i> + 3))
                    × <i>S</i> + (1 ÷ (<i>√n</i> + 3)) × <i>S<sub>a</sub></i>
            </blockquote>
            <i>n</i> is the number of solutions in this hole in this language.
            <i>S</i> is the length of the shortest solution in this hole in
            this language.
            <i>S<sub>a</sub></i> is the shortest solution among all languages
            in this hole.

            <p>
                The confidence interval is chosen such that the shortest
                solution in any language will receive a score of at least 750.

            <p>
                Your overall score is the sum of your highest points in each
                hole.

        <dt>Are submissions resource-constrained?
        <dd>
            Yes. Execution time is limited to 5 seconds, CPU & RAM usage is
            unbounded but this will probably change soon. The length of each
            solution must be lower than 128 KiB as that's the maximum length
            of any program argument under Linux.

        <dt>Is there an API?
        <dd>
            An API is currently being developed and documented in standard
            <a href="https://petstore.swagger.io/?url=https://code.golf/api">
                OpenAPI format</a>.
            A legacy API that just returns scores in JSON exists. The URL is
            <a href=/scores/all-holes/all-langs/all>
                /scores/all-holes/all-langs/all</a>.
            Note that all-holes and all-langs may be replaced by the names of
            specific holes and languages.

        <dt>Can I see other people's solutions?
        <dd>
            No, that way all holes stay competitive. If you're stuck on how to
            shave a couple of strokes off your solution then why not visit
            <a href=//discord.gg/eVCTkYQ>our Discord server</a> for some advice.
    </dl>
</main>

{{ template "footer" }}
